var express = require('express');
var router = express.Router();
const { addImgs,deleteImg } = require('../api/shopGoods')
/* GET home page. */
router.post('/addImgs', async function (req, res, next) {
  const data = await addImgs(req)
  res.send(data);
});
router.delete('/imgs', async function (req, res, next) {
  
  const {_id,images} = req.query
 const url = images.split("http://localhost:3000")[1]
 const data = await deleteImg(url);
  res.send(data)
});

router.patch('/updataImg', async function (req, res, next) {
  console.log(req);
  res.send({})
});
module.exports = router;